Socket
Socket
Sign inDemoInstall

@testing-library/jest-dom

Package Overview
Dependencies
Maintainers
15
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testing-library/jest-dom

Custom jest matchers to test the state of the DOM


Version published
Weekly downloads
12M
increased by7.39%
Maintainers
15
Weekly downloads
 
Created

What is @testing-library/jest-dom?

The @testing-library/jest-dom npm package provides a set of custom jest matchers that you can use to extend jest. These matchers make it easier to assert various things about the state of a DOM node in your tests.

What are @testing-library/jest-dom's main functionalities?

toBeVisible

This allows you to assert whether an element is visible to the user.

expect(element).toBeVisible();

toHaveTextContent

This matcher checks if the element has text content or not.

expect(element).toHaveTextContent('Hello World');

toHaveAttribute

This matcher checks if the element has a specific attribute with an expected value.

expect(element).toHaveAttribute('href', 'https://example.com');

toBeChecked

This matcher checks if a form element like a checkbox or radio button is checked.

expect(checkbox).toBeChecked();

toBeDisabled

This matcher checks if an element is disabled.

expect(button).toBeDisabled();

Other packages similar to @testing-library/jest-dom

Keywords

FAQs

Package last updated on 23 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc